-
Notifications
You must be signed in to change notification settings - Fork 31
feat(cdn): add cdn client, config, list command #1100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(cdn): add cdn client, config, list command #1100
Conversation
Co-authored-by: Ruben Hönle <Ruben.Hoenle@stackit.cloud>
Co-authored-by: Ruben Hönle <Ruben.Hoenle@stackit.cloud>
|
Btw, please always add the Jira issue ID to your PR description if possible :) |
Co-authored-by: Ruben Hönle <Ruben.Hoenle@stackit.cloud>
- replace single char names with more descriptive ones - remove predefined mod functions - deduplicate ParseOriginRequestHeaders and test it - deduplicate ParseGeofencing and test it - add test FlagTo* funcs
|
This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it. |
Merging this branch changes the coverage (1 decrease, 10 increase)
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
Merging this branch changes the coverage (1 decrease, 10 increase)
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
| return err | ||
| } | ||
| if model.Bucket != nil { | ||
| pw, err := params.Printer.PromptForPassword("enter your secret access key for the object storage bucket: ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this work with scripts? Could you add an example please which shows this use-case? 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch, Print.PromptForPassword would need some changes:
@@ -172,11 +172,16 @@ func (p *Printer) PromptForEnter(prompt string) error {
func (p *Printer) PromptForPassword(prompt string) (string, error) {
p.Cmd.PrintErr(prompt)
defer p.Outputln("")
- bytePassword, err := term.ReadPassword(int(syscall.Stdin))
- if err != nil {
- return "", fmt.Errorf("read password: %w", err)
+ if term.IsTerminal(syscall.Stdin) {
+ bytePassword, err := term.ReadPassword(int(syscall.Stdin))
+ if err != nil {
+ return "", fmt.Errorf("read password: %w", err)
+ }
+ return string(bytePassword), nil
}
- return string(bytePassword), nil
+ // Fallback for non-terminal environments
+ reader := bufio.NewReader(p.Cmd.InOrStdin())
+ return reader.ReadString('\n')
}
With this a script like:
#!/usr/bin/env bash
cat secret | bin/stackit beta cdn distribution create -y --project-id xxx --bucket --bucket-url https://bucket.example.com \
--bucket-credentials-access-key-id yyyy --bucket-region EU \
--regions AF,EU
works.
Should we change Print.PromptForPassword accordingly?
Other commands (observability-credentials/update; loadbalancer/add) read passwords as command line arguments, which can be read by other processes.
Imo we should use env vars and/or stdin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer stdin, else we have a mess with hundreds of env variables some day 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change Print.PromptForPassword accordingly?
yes, please. If you're confident to do that do it within this PR. If not please create a Jira issue for it and bring it up in the refinement @cgoetz-inovex 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other commands (observability-credentials/update; loadbalancer/add) read passwords as command line arguments, which can be read by other processes.
Also please feel free to open Jira issues for these args so we can deprecate them in the future and replace them with appropriate input methods. 😉
- fix `ID` spelling - add missing new line at end of output - rm TODO comment
Description
Issue: STACKITCLI-70
Checklist
make fmtmake generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)